import Vue from 'vue'
import Router from 'vue-router'
import index from '@/components/index'
import SideslipMenu from '@/components/SideslipMenu'//侧滑菜单
import longrent from '@/components/longrent' //   	长租首页
import shortrent from '@/components/shortrent' //   	日租首页
import search from '@/components/search'
import shortList from '@/components/shortList' //   	日租时租列表
import longList from '@/components/longList' //   	长租列表
import shortDetails from '@/components/shortDetails' //日租房详情页
import shortdsupfac from '@/components/shortdsupfac' //配套设施
import ShortRules from '@/components/ShortRules' //交易规则
import longDetails from '@/components/longDetails' //长租房详情页
import longDetails_pay from '@/components/longDetails_pay' //长租房详情页_付款方式
import price from '@/components/price' //搜索价格选择
import Myaddress from '@/components/Myaddress' //搜索地址选择
import mapHouse from '@/components/mapHouse' //地图找房
import login from '@/components/login' //登录
import BindingPhone from '@/components/BindingPhone' //绑定账号
import loginSet from '@/components/loginSet' //账户设置
import aboutwe from '@/components/aboutwe' //关于我们
import loginModjpass from '@/components/loginModjpass' //修改登录密码
import longhouseMaster from '@/components/longhouseMaster' //公寓介绍




import tenantPersonal from '@/components/tenantPersonal' //房客个人中心
import tpopinion from '@/components/tp-opinion' //房客个人中心-意见反馈
import tpbrowse from '@/components/tp-browse' //房客个人中心-浏览记录
import TpCoupon from '@/components/TpCoupon' //房客个人中心-优惠券
import ChoiceCoupon from '@/components/ChoiceCoupon' //下单选择优惠券
import TpCouponDh from '@/components/TpCouponDh' //房客个人中心-兑换优惠券
import TpCouponInfo from '@/components/TpCouponInfo' //房客个人中心-优惠券详情
import TpRnaZ from '@/components/TpRnaZ' //房客个人中心-主体认证
//import TpRna from '@/components/TpRna' //房客个人中心-个人房东实名认证
import TpReview from '@/components/TpReview' //房客个人中心-点评管理
import TpUserNum from '@/components/TpUserNum' //房客个人中心-常用入住人
import ChoiceNum from '@/components/ChoiceNum' //下单-选择入住人
import TpUserNumAdd from '@/components/TpUserNumAdd' //房客个人中心-添加入住人


import landlordPersonal from '@/components/landlordPersonal' //房东个人中心
import lpwithdrawals from '@/components/lp-withdrawals' //房东个人中心-提现
import lpwithdrawalsSc from '@/components/lp-withdrawalsSc' //房东个人中心-提现成功

import PerfectInfo from '@/components/PerfectInfo' //完善资料


import TenantOrder from '@/components/TenantOrder' //房客订单列表
import AliWapPay from '@/components/AliWapPay' //房客订单列表--支付页面
import UserRefund from '@/components/UserRefund' //房客订单列表->退房页面
import UserRefundLong from '@/components/UserRefundLong' //房客订单列表->长租退房页面
import OrderComment from '@/components/OrderComment' //房客订单列表->发表评论
import OrderComSuccess from '@/components/OrderComSuccess' //房客订单列表->评论成功
import LongBill from '@/components/LongBill' //房客订单列表->长租订单


import CollectionList from '@/components/CollectionList' //收藏列表


import LandSeizure from '@/components/LandSeizure' //扣押



import ToderInfo from '@/components/ToderInfo' //短租房客订单详情
import LoderInfo from '@/components/LoderInfo' //长租房客订单详情
import PaymentDetails from '@/components/PaymentDetails' //支付明细
import CheckoutHouse from '@/components/CheckoutHouse' //查看退房


import HouseApply from '@/components/HouseApply' //申请预定
import bedsList from '@/components/bedsList' //申请预定--床位
import LongHouseApply from '@/components/LongHouseApply' //长申请预定



import ZhuddNews from '@/components/ZhuddNews' //消息中心
import ZhuddNewsInfo from '@/components/ZhuddNewsInfo' //消息中心--聊天

Vue.use(Router)
export default new Router({
	mode: 'history',
	routes: [{
			path: '/',
			name: 'index',
			component: index,
			meta: {
				title: '首页',
				keepAlive: false,
			}
		},{
			path: '/SideslipMenu',
			name: 'SideslipMenu',
			component: SideslipMenu,
			meta: {
				keepAlive: false,
			}
		},{
			path: '/BindingPhone',
			name: 'BindingPhone',
			component: BindingPhone,
			meta: {
				title: '绑定住多多账号'
			}
		}, {
			path: '/login',
			name: 'login',
			component: login,
			meta: {
				title: '登录'
			}
		},   {
			path: '/loginSet',
			name: 'loginSet',
			component: loginSet,
			meta: {
				title: '账户设置'
			}
		},  {
			path: '/aboutwe',
			name: 'aboutwe',
			component: aboutwe,
			meta: {
				title: '关于我们'
			}
		}, {
			path: '/loginModjpass',
			name: 'loginModjpass',
			component: loginModjpass,
			meta: {
				title: '修改登录密码'
			}
		},
		{
			//   	长租首页
			path: '/longrent',
			name: 'longrent',
			component: longrent,
			meta: {
				title: '长租公寓',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	公寓介绍
			path: '/longhouseMaster',
			name: 'longhouseMaster',
			component: longhouseMaster,
			meta: {
				title: '公寓列表'
			}
		},
		{
			//   	日租首页
			path: '/shortrent',
			name: 'shortrent',
			component: shortrent,
			meta: {
				title: '短租民宿',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		}, {
			//   	日租时租列表搜索
			path: '/shortList',
			name: 'shortList',
			component: shortList,
			meta: {
				title: '日租列表',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	长租列表搜索
			path: '/longList',
			name: 'longList',
			component: longList,
			meta: {
				title: '长租列表',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	日租房详情页
			path: '/shortDetails',
			name: 'shortDetails',
			component: shortDetails,
			meta: {
				title: '日租详情',
				keepAlive: false,
			}
		},
		{
			//   	配套设施
			path: '/shortdsupfac',
			name: 'shortdsupfac',
			component: shortdsupfac,
			meta: {
				title: '配套设施',
				keepAlive:false,
			}
		},
		{
			//   	交易规则
			path: '/ShortRules',
			name: 'ShortRules',
			component: ShortRules,
			meta: {
				title: '退订须知',
				keepAlive: false,
			}
		},
		{
			//   	长租房详情页
			path: '/longDetails',
			name: 'longDetails',
			component: longDetails,
			meta: {
				title: '长租详情',
				keepAlive: false,
			}
		},
		{
			//   	长租房详情页_付款方式
			path: '/longDetails_pay',
			name: 'longDetails_pay',
			component: longDetails_pay,
			meta: {
				title: '付款方式',
				keepAlive: false,
			}
		},
		{
			//   	搜索价格选择
			path: '/price',
			name: 'price',
			component: price,
			meta: {
				title: '价格选择',
			}
		},
		{
			//   	搜索地址选择
			path: '/Myaddress',
			name: 'Myaddress',
			component: Myaddress,
			meta: {
				title: '搜索地址',
				keepAlive: false,
			}
		}, {
			//   	地图找房
			path: '/mapHouse',
			name: 'mapHouse',
			component: mapHouse,
			meta: {
				title: '地图找房',
				keepAlive: false,
			}
		},
		{
			//   	搜索
			path: '/search',
			name: 'search',
			component: search,
			meta: {
				title: '搜索',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	房客个人中心
			path: '/tenantPersonal',
			name: 'tenantPersonal',
			component: tenantPersonal,
			meta: {
				title: '个人中心',
			}
		},
		
		{
			//   	房客个人中心-意见反馈
			path: '/tpopinion',
			name: 'tpopinion',
			component: tpopinion,
			meta: {
				title: '意见反馈',
			}
		},
		{
			//   	房客个人中心-浏览记录
			path: '/tpbrowse',
			name: 'tpbrowse',
			component: tpbrowse,
			meta: {
				title: '浏览记录',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	房客个人中心-优惠券
			path: '/TpCoupon',
			name: 'TpCoupon',
			component: TpCoupon,
			meta: {
				title: '我的优惠券',
			}
		},
		{
			//   	下单-选择优惠券
			path: '/ChoiceCoupon',
			name: 'ChoiceCoupon',
			component: ChoiceCoupon,
			meta: {
				title: '选择优惠券',
			}
		},
		{
			//   	房客个人中心-兑换优惠券
			path: '/TpCouponDh',
			name: 'TpCouponDh',
			component: TpCouponDh,
			meta: {
				title: '兑换优惠券',
			}
		},
		{
			//   	房客个人中心-优惠券详情
			path: '/TpCouponInfo',
			name: 'TpCouponInfo',
			component: TpCouponInfo,
			meta: {
				title: '优惠券详情',
			}
		},
		
		{
			//   	房客个人中心-主体认证
			path: '/TpRnaZ',
			name: 'TpRnaZ',
			component: TpRnaZ,
			meta: {
				title: '主体认证',
			}
		},
//		{
//			//   	房客个人中心-个体房东实名认证
//			path: '/TpRna',
//			name: 'TpRna',
//			component: TpRna,
//			meta: {
//				title: '个人房东',
//			}
//		},
		
		{
			//   	房客个人中心-点评管理
			path: '/TpReview',
			name: 'TpReview',
			component: TpReview,
			meta: {
				title: '点评管理',
			}
		},
		{
			//   	房客个人中心-常用入住人
			path: '/TpUserNum',
			name: 'TpUserNum',
			component: TpUserNum,
			meta: {
				title: '常用入住人',
			}
		},
		{
			//   	下单-选择入住人
			path: '/ChoiceNum',
			name: 'ChoiceNum',
			component: ChoiceNum,
			meta: {
				title: '选择入住人',
			}
		},
		{
			//   	房客个人中心-添加常用入住人
			path: '/TpUserNumAdd',
			name: 'TpUserNumAdd',
			component: TpUserNumAdd,
			meta: {
				title: '添加入住人',
			}
		},
		{
			//   	房东个人中心
			path: '/landlordPersonal',
			name: 'landlordPersonal',
			component: landlordPersonal,
			meta: {
				title: '个人中心',
			}
		},
			{//   	完善资料
			path: '/PerfectInfo',
			name: 'PerfectInfo',
			component: PerfectInfo,
			meta: {
				title: '完善资料',
			}
		},
		{
			//   	房东个人中心-提现
			path: '/lpwithdrawals',
			name: 'lpwithdrawals',
			component: lpwithdrawals,
			meta: {
				title: '提现',
			}
		},
		{
			//   	房东个人中心-提现
			path: '/lpwithdrawalsSc',
			name: 'lpwithdrawalsSc',
			component: lpwithdrawalsSc,
			meta: {
				title: '提现',
			}
		},
		{
			//   	房客订单列表
			path: '/TenantOrder',
			name: 'TenantOrder',
			component: TenantOrder,
			meta: {
				title: '房客订单列表',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	房客订单列表--支付页面
			path: '/AliWapPay',
			name: 'AliWapPay',
			component: AliWapPay,
			meta: {
				title: '支付',
			}
		},
		{
			//   	房客订单列表->退房页面
			path: '/UserRefund',
			name: 'UserRefund',
			component: UserRefund,
			meta: {
				title: '提前退房',
				keepAlive: false,
			}
		},
		{
			//   	房客订单列表->长租退房页面
			path: '/UserRefundLong',
			name: 'UserRefundLong',
			component: UserRefundLong,
			meta: {
				title: '提前退房',
				keepAlive: false,
			}
		},
		{
			//   	房客订单列表->发表评论
			path: '/OrderComment',
			name: 'OrderComment',
			component: OrderComment,
			meta: {
				title: '发表评论',
				keepAlive: false,
			}
		},
		{
			//   	房客订单列表->评论成功
			path: '/OrderComSuccess',
			name: 'OrderComSuccess',
			component: OrderComSuccess,
			meta: {
				title: '评论成功',
				keepAlive: false,
			}
		},
		{
			//   	房客订单列表->长租账单
			path: '/LongBill',
			name: 'LongBill',
			component: LongBill,
			meta: {
				title: '账单',
				keepAlive: false,
			}
		},
		{
			//   	房客收藏列表
			path: '/CollectionList',
			name: 'CollectionList',
			component: CollectionList,
			meta: {
				title: '房客收藏列表',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	扣押押金
			path: '/LandSeizure',
			name: 'LandSeizure',
			component: LandSeizure,
			meta: {
				title: '扣押',
			}
		},
		{
			//   	短租房客订单详情
			path: '/ToderInfo',
			name: 'ToderInfo',
			component: ToderInfo,
			meta: {
				title: '短租房客订单详情',
			}
		},
		{
			//   	长租房客订单详情
			path: '/LoderInfo',
			name: 'LoderInfo',
			component: LoderInfo,
			meta: {
				title: '长租房客订单详情',
			}
		},
		{
			//   	支付明细
			path: '/PaymentDetails',
			name: 'PaymentDetails',
			component: PaymentDetails,
			meta: {
				title: '支付明细',
			}
		},
		{
			//   	退房详情
			path: '/CheckoutHouse',
			name: 'CheckoutHouse',
			component: CheckoutHouse,
			meta: {
				title: '退房详情',
			}
		}
		,
		{
			//   	申请预订
			path: '/HouseApply',
			name: 'HouseApply',
			component: HouseApply,
			meta: {
				title: '申请预订',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		},
		{
			//   	申请预订-床位
			path: '/bedsList',
			name: 'bedsList',
			component: bedsList,
			meta: {
				title: '选择床位',
			}
		},
		{
			//   	申请预订
			path: '/LongHouseApply',
			name: 'LongHouseApply',
			component: LongHouseApply,
			meta: {
				title: '申请预订',
			}
		},
		{
			//   	消息中心
			path: '/ZhuddNews',
			name: 'ZhuddNews',
			component: ZhuddNews,
			meta: {
				title: '消息中心',
				keepAlive: true,
				isBack: false, //用于判断上一个页面是哪个
			}
		}
		,
		{
			//   	消息中心-聊天页面
			path: '/ZhuddNewsInfo',
			name: 'ZhuddNewsInfo',
			component: ZhuddNewsInfo,
			meta: {
			}
		}
	],
	scrollBehavior(to, from, savedPosition) {
		if(savedPosition) {
			return savedPosition
		} else {
			if(from.meta.keepAlive) {
				from.meta.savedPosition = document.body.scrollTop
			}
			return {
				x: 0,
				y: to.meta.savedPosition || 0
			}
		}
	},

})